﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
using System.Collections.Generic;
using aucn.web.au.code;

namespace aucn.web.au
{
    public partial class PostGradList : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            XmlDocument doc = new XmlDocument();
            List<MasterDept> deptList = new List<MasterDept>();

            try
            {
                if (Cache["MASTER_PROG_LIST"] == null)
                {

                    doc.Load(Server.MapPath("~/App_Data/master.xml"));
                    XmlNamespaceManager xm = new XmlNamespaceManager(doc.NameTable);
                    xm.AddNamespace("x", "http://tempuri.org/master.xsd");
                    XmlNodeList nodeList = doc.DocumentElement.SelectNodes("x:department", xm);
                    foreach (XmlNode node in nodeList)
                    {
                        //Department d = new Department(node.Attributes["name"].Value, node.SelectSingleNode("x:name", xm).InnerText, node.SelectSingleNode("x:chname", xm).InnerText, "", "", "", null);
                        MasterDept d = new MasterDept(node.Attributes["name"].Value, node.SelectSingleNode("x:name", xm).InnerText, node.SelectSingleNode("x:name", xm).InnerText, string.Empty, null);
                        deptList.Add(d);
                    }

                    Cache["MASTER_PROG_LIST"] = deptList;
                }

                Repeater1.DataSource = Cache["MASTER_PROG_LIST"];
                Repeater1.DataBind();
                //Cache["DEPTLIST"] = html.ToString();
                //ltrDepts.Text = (string)Cache["DEPTLIST"];
            }
            catch
            {
            }
        }
    }
}